// pages/mine/CollectHost/CollectHost.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    CollectList: [],
    page_host: 1
  },
  //去简历详情
  go_detail(e){
    console.log(e)
    let resume_id = e.currentTarget.dataset.resume_id;
    wx.navigateTo({
      url: '../../recruit/singleRecruit/singleRecruit?resume_id=' + resume_id+"&flag=col",
    })
  },
  //简历加载
  LoadHost: function(e) {
    let that = this;
    let page_host = this.data.page_host;
    page_host = page_host + 1;
    that.setData({
      page_host: page_host
    })
    this.List_Host();
  },
  //简历加载
  HostList(_page) {
    let that = this;
    wx.request({
      method: 'POST',
      url: app.globalData.url + 'api/welfare/guild/collect/list',
      data: {
        token: app.globalData.token,
        page: _page
      },
      success: function(e) {
        console.log(e)
        if (e.data.data.resume.current_page > e.data.data.resume.last_page) {
          console.log("到底了");
          wx.showToast({
            title: '到底啦~',
            icon: 'none',
          })
        } else {
          if (that.data.page_host == 1) {
            that.setData({
              CollectList: e.data.data.resume.data,
            })
          } else {
            // console.log("不不不不不");
            let CollectList = that.data.CollectList;
            let _CollectList = e.data.data.resume.data;
            CollectList.push(..._CollectList)
            console.log(CollectList);
            that.setData({
              CollectList: CollectList,
            })
          }
        }
        wx.hideLoading();
      }
    })
  },
  // 简历加载
  List_Host: function(e) {
    let that = this;
    let page_host = this.data.page_host
    that.HostList(page_host);
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    var that = this;
    this.List_Host();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})